cc = g++
mkdir = mkdir -p
ar = ar crl
ranlib = ranlib
mv = mv
rm = rm
rmdir = rm -r 
cp = cp
# ----------------------- files
build = build/
objdir = build/obj
target = libbasement.a
objs = BAllocator.o BArray.o BAutoreleasePool.o BDictionary.o BException.o BLog.o BNull.o BNumber.o BObject.o BString.o BThread.o

# ----------------------- flags
cflags = -I. -arch i386 -arch x86_64 -arch ppc -arch ppc64

all:
	@echo "--------------------------------------"
	@echo "Target: ${target}"
	@echo "Compiling with flags: ${cflags}"
	@echo "--------------------------------------"
	@make ${target}

${target}: ${objs}
	@echo "--> Build: ${target}"
	@${ar} ${target} ${objs}
	@${ranlib} ${target}
	@${mkdir} ${build}
	@${mkdir} ${objdir}
	@${mv} ${target} ${build}
	@${mv} *.o ${objdir}
	@echo "--> Copying header files"
	@${mkdir} ${build}include
	@${cp} *.h ${build}include
	@echo "--> Done!"

%.o: %.cpp Makefile
	@echo "--> Compile: $<"
	@${cc} ${cflags} -c $<

clean:
	@echo "Cleaning up..."
	@${rmdir} ${build}